package com.project.service.server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class LisServer {

    public LisServer(){
        try {
            //B/S
            //开启服务器，开放8088端口
            ServerSocket serverSocket = new ServerSocket(8088);

            while(true){
                //监听端口，如果有客户端连接到服务器，将连接信息封装成socket对象
                Socket socket = serverSocket.accept();
                //每连接一个客户端，就开启新线程处理该客户端的请求
                new SocketThread(socket);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new LisServer();
    }
}
